<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <title>One day escape</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta name="description" content="" />
    <meta name="keywords" content="" />
    <link rel="stylesheet" href="src/css/n.min.css">
    <script>
        (function(){
            var phoneWidth =  parseInt(window.screen.width);
            var phoneScale = phoneWidth/640;
            var isAndroid = RegExp("Android").test(navigator.userAgent);
            if (isAndroid) {
                document.write('<meta name="viewport" content="width=640, minimum-scale = '+phoneScale+', maximum-scale = '+phoneScale+', target-densitydpi=device-dpi">');
            } else {
                document.write('<meta name="viewport" content="width=640, user-scalable=no, target-densitydpi=device-dpi">');
            }
        }());
    </script>
</head>

<body class="app" style="width: 100%;height: 100%; /*overflow: hidden;*/background: orange;">

    <div class="container" style="width: 640px;margin: 0 auto;">

        <div class="swiper-container" >
            <div class="swiper-wrapper" style="">
                <div class="swiper-slide" style="background-size:auto 100%;background: url(src/images/slide/01.jpg)">
                    <i class="up icon-up"></i>
                </div>
                <div class="swiper-slide" style="background-size:auto 100%;background: url(src/images/slide/02.jpg)">
                    <i class="up icon-up"></i>
                </div>
                <!--<div class="swiper-slide  " style="background-size:auto 100%;background: url(src/img/slide/03.jpg)">-->
                    <!--<img class="up upimg" src="src/img/slide/up.png">-->
                <!--</div>-->
                <!--<div class="swiper-slide  " style="background-size:auto 100%;background: url(src/img/slide/04.jpg)">-->
                    <!--<img class="up upimg" src="src/img/slide/up.png">-->
                <!--</div>-->
                <!--<div class="swiper-slide  " style="background-size:auto 100%;background: url(src/img/slide/05.jpg)">-->
                    <!--<img class="up upimg" src="src/img/slide/up.png">-->
                <!--</div>-->
                <!--<div class="swiper-slide  " style="background-size:auto 100%;background: url(src/img/slide/06.jpg)">-->
                    <!--<img class="up upimg" src="src/img/slide/up.png">-->
                <!--</div>-->
                <!--<div class="swiper-slide " style="background-size:auto 100%;background: url(src/img/slide/07.jpg)">-->
                    <!--<img class="goimg" src="src/img/slide/go.png">-->
                    <!--<img class="up upimg" src="src/img/slide/up.png">-->
                <!--</div>-->
                <div class="swiper-slide index-box">
                    <a href="javascript:void(0)" class="share-btn"></a>
                    <a href="1.html" class="go-page-one"></a>
                    <a href="2.html" class="go-page-two"></a>
                </div>
            </div>
        </div>
    </div>

    <div class="wechat-overlay" style="display:none;">
        <div class="wechat-dialog"></div>
    </div>

    <script src="src/js/zepto.min.js"></script>
    <script src="src/js/swiper.jquery.min.js"></script>
    <script>
        Zepto(function($){

            $(".swiper-wrapper").css("height",$(window).height());

            var swiper = new Swiper('.swiper-container', {
                direction: 'vertical',
                onSlideChangeEnd:function(obj){

                }
            });

            var isWeixin = function () {
                var ua = navigator.userAgent.toLowerCase();
                if (ua.match(/MicroMessenger/i) == 'micromessenger') {
                    return true;
                } else {
                    return false;
                }
            };

            var u = navigator.userAgent;
            var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1;
            var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            var iconURL = encodeURIComponent('http://img.one-dao.com/image/h5/crazytraveler.png');
            var detailURL = encodeURIComponent('http://www.one-dao.com/html/crazytraveler/index.html');
            var title = encodeURIComponent('一道走疯狂旅行家，赢5万元旅游基金！');
            var description = encodeURIComponent('现在创建主题行程，赢5万元旅游基金！一道走带你体验最深度的旅行方式，疯狂玩转五大洲！');
            $('.wechat-overlay').click(function() {
                $(this).hide();
            });
            $('.share-btn').click(function() {
                if(isWeixin()) {
                    $('.wechat-overlay').show();
                } else {
                    if (isAndroid && window.YiDaoZou) {
                        YiDaoZou.shareOpenMenu(iconURL, detailURL, title, description);
                    } else if(isiOS) {
                        document.location = 'share_openMenu://?iconURL=' + iconURL + '&detailURL=' + detailURL + '&title=' + title + '&description=' + description;
                    }
                }
            });

            var getParam = function(name){
                var search = document.location.search;
                var pattern = new RegExp("[?&]"+name+"\=([^&]+)", "g");
                var matcher = pattern.exec(search);
                var items = null;
                if(null != matcher){
                    try{
                        items = decodeURIComponent(decodeURIComponent(matcher[1]));
                    }catch(e){
                        try{
                            items = decodeURIComponent(matcher[1]);
                        }catch(e){
                            items = matcher[1];
                        }
                    }
                }
                return items;
            };

            if(!isWeixin()) {

                var script=document.createElement("script");
                script.src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js";

                script.onload=function(){

                    var wxScript = document.createElement("script");
                    wxScript.src = "src/js/weixin.js";

                    script.onload=function(){
                        new Weixin().init({
                            title: "一道走疯狂旅行家，赢5万元旅游基金！",
                            desc: "现在创建主题行程,赢5万元旅游基金!一道走带你体验最深度的旅游方式,疯狂玩转5大洲!",
                            link: window.location.href,
                            imgUrl: "http://www.one-dao.com/html/crazytraveler/src/img/sharepng.png",
                            type: "",
                            dataUrl: "",
                            success: function (res) {},
                            cancel: function (res) {}
                        });
                    }

                    document.head.appendChild(wxScript);

                }
                document.head.appendChild(script);
            }

            var userId = getParam('userId');
            if(userId) {
                $('.go-page-one').attr('href', $('.go-page-one').attr('href') + '?userId=' + userId);
                $('.go-page-two').attr('href', $('.go-page-two').attr('href') + '?userId=' + userId);
            }

        })
    </script>

</body>

</html>
